package com.blockmeta.bbs.immodule.fragment;


import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.blockmeta.bbs.baselibrary.base.adapter.BaseTabViewPagerAdapter;
import com.blockmeta.bbs.baselibrary.widget.tab.SlidingTabLayout;
import com.blockmeta.bbs.businesslibrary.base.fragment.BaseLazyFragment;
import com.blockmeta.bbs.immodule.R;
import com.blockmeta.bbs.immodule.R2;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * A simple {@link Fragment} subclass.
 */
public class AddressBookFragment extends BaseLazyFragment {

    @BindView(R2.id.tab_layout)
    SlidingTabLayout mTabLayout;
    @BindView(R2.id.vp_container)
    ViewPager mVpContainer;

    private CirclesFragment mCirclesFragment;
    private FriendsFragment mFriendsFragment;
    public AddressBookFragment() {
        // Required empty public constructor
    }


    @Override
    public View setContentView(LayoutInflater inflater, ViewGroup container) {
        return inflater.inflate(R.layout.fragment_address_book, container, false);
    }

    @Override
    protected void initializeLayout() {
        List<Fragment> fragments = new ArrayList<>(4);
        mCirclesFragment = CirclesFragment.newInstance(false, true);
        mFriendsFragment = FriendsFragment.newInstance(false, true);
        fragments.add(mCirclesFragment);
        fragments.add(mFriendsFragment);
        List<String> title = new ArrayList<>(4);
        title.add("兴趣圈");
        title.add("趣友");
        BaseTabViewPagerAdapter vpAdapter = new BaseTabViewPagerAdapter(getChildFragmentManager(), fragments, title);
        mVpContainer.setAdapter(vpAdapter);

        mTabLayout.setViewPager(mVpContainer);
    }

    @Override
    protected void netWork() {

    }

    /**
     * 每当这个页面可见的时候就要去请求Socket
     * 拿到最新的好友列表，交给子Fragment去处理
     */
    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }


    @Override
    public void onDestroy() {
        super.onDestroy();
    }

}
